home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.0 / card_6103.txt < prev    next >
Text File  |  1989-02-26  |  4KB  |  189 lines

  1. -- card: 6103 from stack: in.0
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 2612
  5. -- name: SoundCapToRes
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: A003
  11. -- rect: left=82 top=302 right=324 bottom=182
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Install
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   if the optionkey is down then
  23.     pass mouseup
  24.   end if
  25.  
  26.   put (long name of this stack) into sourceStack
  27.   delete first word of sourceStack
  28.   delete first character of sourceStack
  29.   delete last character of sourceStack
  30.   put "Select a stack to copy this resource into."
  31.   put filename("STAK") into fname
  32.   if fname is empty then
  33.     hide message window
  34.     exit mouseup
  35.   end if
  36.   if sourcestack=fname then
  37.     beep
  38.     Answer "Get real.  You can't install it in this stack"
  39.     hide message window
  40.     exit mouseup
  41.   end if
  42.  
  43.   --
  44.   ModResCopy sourceStack,fname,"XCMD","SoundCapToRes"
  45.   --
  46.   get the result
  47.   if first char of it is "E" then
  48.     put it into the message box
  49.     beep
  50.     answer "Attempt to install resource has failed."
  51.   else
  52.     beep
  53.     answer "Resource installation successful"
  54.   end if
  55.   hide message window
  56. end mouseUp
  57.  
  58.  
  59.  
  60. -- part 2 (button)
  61. -- low flags: 00
  62. -- high flags: A003
  63. -- rect: left=163 top=265 right=290 bottom=282
  64. -- title width / last selected line: 0
  65. -- icon id / first selected line: 0 / 0
  66. -- text alignment: 1
  67. -- font id: 0
  68. -- text size: 12
  69. -- style flags: 0
  70. -- line height: 16
  71. -- part name: Convert Sounds
  72. ----- HyperTalk script -----
  73. on mouseUp
  74.   if the optionkey is down then
  75.     pass mouseup
  76.   end if
  77.  
  78.   global SoundName,SampleRate,ResName,Destination
  79.  
  80.   put "This lets you convert soundcap or soundwave sounds and install them."
  81.  
  82.   -- get the name of the original sound file
  83.   answer "You may now select the sound file" with "Cancel" or "OK"
  84.   if it = "Cancel" then
  85.     play boing
  86.     hide message window
  87.     exit mouseup
  88.   end if
  89.  
  90.   put filename(FSSD) into SoundName
  91.   if SoundName is empty then
  92.     hide message window
  93.     play boing
  94.     exit mouseup
  95.   end if
  96.   put quote&SoundName"e into SoundName
  97.  
  98.   -- get the sampling rate (between 1 and 4)
  99.   ask "What sample rate should be used? (1,2,3 or 4)" with "2"
  100.   if it <1 or it >4 then
  101.     play boing twice
  102.     hide message window
  103.     exit mouseup
  104.   end if
  105.  
  106.   if it =1 then put 60 into it else
  107.   if it =2 then put 72 into it else
  108.   if it =3 then put 79 into it else put 84 into it
  109. end if
  110. end if
  111. put it into SampleRate
  112.  
  113. -- let user name the sound resource
  114. ask "What do you want to name this sound?"
  115. if it is empty then
  116.   play boing
  117.   hide message window
  118.   exit mouseup
  119. end if
  120. put it into ResName
  121.  
  122. -- get the name of the destination stack
  123. put "Please select the destination stack"
  124. put filename ("STAK") into Destination
  125. if Destination is empty then
  126.   hide message window
  127.   play boing
  128.   exit mouseup
  129. end if
  130. put quote&Destination"e into Destination
  131.  
  132. -- do the conversion using the XCMD 'SoundCaptoRes'
  133.  
  134. -- SoundCapToRes takes four arguments:
  135. -- the name you want to call the sound
  136. -- the file that contains the SoundCap output (in quotes)
  137. -- the stack in which you want to put the sound
  138. -- the base pitch of the sound (60, 72, 79, or 84)
  139.  
  140. put ResName into Args
  141. put ","&SoundName after Args
  142. put ","&Destination after Args
  143. put ","&SampleRate after Args
  144.  
  145. do "SoundCaptoRes" && Args
  146.  
  147. -- go to the target stack and test the sound
  148. push card
  149. go to Destination
  150. play ResName
  151. repeat while the sound is not "done"
  152. end repeat
  153. pop card
  154. end mouseUp
  155.  
  156.  
  157.  
  158. -- part contents for background part 13
  159. ----- text -----
  160. 5
  161.  
  162. -- part contents for background part 2
  163. ----- text -----
  164. SoundCapToRes
  165.  
  166. -- part contents for background part 3
  167. ----- text -----
  168.  
  169. This will convert a SoundCap or SoundWave file into a 
  170. 'snd' resource and install it into a specified stack.
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178. Thanks to:
  179. ? (If anyone knows who wrote this please pass the information on so proper credit can be given.)
  180.  
  181.  
  182.  
  183. -- part contents for background part 10
  184. ----- text -----
  185. Syntax:
  186.  
  187. SoundCapToRes <ResourceName>,
  188. <SourceFile>,<DestinationFile>,
  189. <SampleRate>